package com.strategy;

import com.responChainModel.AuthLink;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

public class test {

    protected Logger logger = LoggerFactory.getLogger(test.class);

    @Test
    public void test_zj() {
        // 直减；100-10，商品100元
        Context<Double> context = new Context<Double>(new ZJCouponDiscount());
        BigDecimal discountAmount = context.discountAmount(10D, new
                BigDecimal(100));
        logger.info("测试结果：直减优惠后⾦额 {}", discountAmount);
    }


    @Test
    public void test_mj() {
        // 满100减10，商品100元
        Context<Map<String,String>> context = new Context<Map<String,String>>
                (new MJCouponDiscount());
        Map<String,String> mapReq = new HashMap<String, String>();
        mapReq.put("x","100");
        mapReq.put("n","10");
        BigDecimal discountAmount = context.discountAmount(mapReq, new
                BigDecimal(100));
        logger.info("测试结果：满减优惠后⾦额 {}", discountAmount);
    }
}
